<template>
  <div></div>
</template>

<script>
  import {take, map,mergeAll,mergeMap} from 'rxjs/operators'  //注意merge是静态的,mergeAll是实例主导的
  import {fromEvent, interval, merge} from 'rxjs'

  /*
  *
*/
  export default {
    name: "merge-map",
    mounted() {
      const clicks = fromEvent(document, 'click');
      const higherOrder = clicks.pipe(mergeMap(x=>interval(1000))); //高阶函数

      higherOrder.subscribe(x => {
        console.log(typeof x,x);///已扁平化,不需要嵌套
      });
    }
  }
</script>

<style scoped>

</style>
